<template>
    <div>
      <div class="nav">
        <router-link to="/mine">
          <img src="../../assets/lyl/image/tuijian/BMQD-1.png" alt="">
        </router-link>
        <p>我的返金排行</p>
      </div>
      <div class="content" ref="content">
        <span :class="{active:cur==index}" @click="conis(index)" v-for="(item,index) in data2">{{item}}</span>
        <img @click="conn()" src="/static/lyl/youjian.png" alt="">
      </div>
      <component :is="coms"></component>
    </div>
</template>

<script>
  import Paifan1 from './Paifan1'
  import Paifan2 from './Paifan2'
  import Paifan3 from './Paifan3'
  import Paifan4 from './Paifan4'
    export default {
      name: "Paifan",
      data(){
        return {
          coms:'Paifan1',
          cur:0,
          data2:['0~499元','500~999元','1000~1499元','1500~1999元']
        }
      },
      methods:{
        conis(i){
          this.cur = i;
          this.coms = 'Paifan'+(i+1)
        },
        conn(){
          this.$refs.content.scrollLeft += 400;
        }
      },
      components:{
        Paifan1,
        Paifan2,
        Paifan3,
        Paifan4
      }
    }
</script>

<style scoped>
  .nav{
    width: 100%;
    background: #e53e42;
    padding: 3.5rem 0;
    display: flex;
    justify-content: center;
  }
  .nav a{
    position: absolute;
    left: 2rem;
    color: #fff;
    font-size: 34px;
  }
  .nav p{
    font-size: 34px;
    color:#fff;
  }
  .content{
    width: 100%;
    border-bottom: 1px solid #ccc;
    padding: 2.5rem 2rem;
    display: flex;
    justify-content: space-between;
    overflow-x: scroll;
  }
  .content span{
    flex-shrink: 0;
    font-size: 2.8rem;
    line-height: 3.6rem;
    padding-right: 9rem;
  }
  .content img{
    position: absolute;
    right: 0;
    width: 1.3rem;
    height: 2.2rem;
    align-self: center;
  }
  .active{
    color: #e53e42;
  }
</style>
